package file;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 字符流的读操作
 * User: 王圆豪
 * Date: 2025-05-11
 * Time: 18:15
 */
public class Demo11 {
    public static void main(String[] args) {
        try (Reader reader = new FileReader("./test.txt")) {
            char[] s = new char[1024];
            int n = reader.read(s);
            for (int i = 0; i < n; i++) {
                System.out.println(s[i]);
            }
//            while (true) {
//                int data = reader.read();
//                if(data == -1) break;
//                System.out.println(data);
//            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
